using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Jewelry.BussinessLayer;
using Jewelry.Entities;
using Mgh.Utilities;

public partial class Pages_ALogin : Mgh.UI.Sql.PageBase
{
    string TargetURL
    {
        get { return Request.QueryString["url"] == null ? string.Empty : Request.QueryString["url"]; }
    }

    override protected void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load(sender, e);
        if (!IsPostBack)
        {
 
        }
    }

    protected void btLogin_Click(object sender, EventArgs e)
    {
        AccountBLL bn = new AccountBLL(getCurrentConnect());
        if (bn.checkAdmAcc(txtUsername.Value, txtPassword.Value))
        {
            CurrentUser.logIn(txtUsername.Value, "Admin");
            if (this.TargetURL.Length > 0)
                Response.Redirect(HttpUtility.UrlDecode(this.TargetURL));
            else
                Response.Redirect("AManageOrder.aspx");
        }
        else
        {
            vCustom.IsValid = false;
            vCustom.Text = "Username or password is wrong";
        }
    }
}
